﻿using System;
using System.Threading.Tasks.Dataflow;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace NewTry
{
    public class ConsoleWriteBlock//显示分帧结果
    {
        public ActionBlock<byte[]> _InputBlock;

        public ConsoleWriteBlock()
        {
            _InputBlock = new ActionBlock<byte[]>(p =>
            {
                Console.Write("output:");
                Console.WriteLine(BitConverter.ToString(p));
            });
        }


        public void Enqueue(byte[] input)
        {
            _InputBlock.Post(input);
        }

        public void Complete()
        {
            _InputBlock.Complete();
        }
    }

    public class ConsoleResultBlock//显示对比结果
    {
        public ActionBlock<(bool, int)> _InputBlock;

        public ConsoleResultBlock()
        {

            _InputBlock = new ActionBlock<(bool, int)>(result =>
            {
                bool re = result.Item1;
                int framenumber = result.Item2;
                if (!re)
                {
                    Console.WriteLine($"文件不同，第 {framenumber} 帧不同");
                }
                else
                {
                    Console.WriteLine($"文件相同");
                }
            });
        }

        public void Enqueue((bool, int) input)
        {
            _InputBlock.Post(input);
        }









    }

}